package com.mdinfo.system.web;

import com.mdinfo.base.common.bean.CommonResult;
import com.mdinfo.base.common.bean.Ref;
import com.mdinfo.system.param.MemberParam;
import com.mdinfo.system.service.IMemberService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * Created by Administrator on 2017/11/30.
 */
@RestController
@RequestMapping("/sys/member")
public class MemberController {

    @Resource
    private IMemberService memberService;

    @RequestMapping("/add")
    public CommonResult<?> add(@Valid MemberParam.AddParam param){
        return memberService.add(param);
    }

    @RequestMapping("/listQuery")
    public CommonResult<?> listQuery(@Valid MemberParam.ListQueryParam param){
        return memberService.listQuery(param);
    }

    @RequestMapping("/modify")
    public CommonResult<?> modify(@Valid MemberParam.ModifyParam param){
        return memberService.modify(param);
    }

    @RequestMapping("/login")
    public CommonResult<?> login(@Valid MemberParam.LoginParam param){

        return memberService.login(param);
    }

    @RequestMapping("/changePass")
    public CommonResult<?> changePass(@Valid MemberParam.ChangePassParam param){
        return memberService.changePass(param);
    }

    @RequestMapping("/online")
    public CommonResult<Void> online(){
        return Ref.ok();
    }
}
